home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
c_lib.arc
/
PCRESEXT.C
< prev
next >
Wrap
Text File
|
1990-08-09
|
1KB
|
40 lines
/**
*
* Name pcresext -- Exit but stay resident
*
* Synopsis pcresext(excode);
* int excode; Exit code to return to DOS
*
* Description This function terminates the current process but makes
* the program resident as part of DOS. The value of excode
* is passed to DOS (or the parent process) and may be
* inspected with either the errorlevel command or the
* PCWAIT function.
*
* Version 1.0 (C)Copyright Blaise Computing Inc. 1983
*
**/
#define utbyword(a,b) (((a)<<8)|((b)&0x00ff)) /* a is high, b low */
struct dreg
{
unsigned ax,bx,cx,dx,si,di,ds,es;
};
#define DOSREG struct dreg
int pcresext(excode)
int excode;
{
DOSREG reg;
unsigned size;
int utinit(),pcshrink(),dos();
pcshrink(&size); /* Get the program size */
utinit(®);
reg.ax = utbyword(0x31,excode); /* DOS function 31 (hex) */
reg.dx = size;
dos(®);
}